public class demo04 {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(()->{
           while (true){
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
        });

        //再启动前获取线程状态，NEW
        System.out.println(t.getName());

        t.start();

        Thread.sleep(2000);
        System.out.println(t.getState());
    }
}
